<template>
	<e-navbar autoBack :bgColor="navbarBgColor"></e-navbar>
	<view style="--e-skeleton-swiper-height:375px">
		<e-skeleton :show="loading">
			<e-skeleton-item variant="swiper"></e-skeleton-item>
			<view class="e-p-20">
				<view class="e-flex">
					<view class="e-radius-8 overflow-hidd">
						<e-skeleton-item variant="block">
							<view style="height:40rpx;width: 300rpx;"></view>
						</e-skeleton-item>
					</view>
				</view>
				<view class="e-p-t-20 e-flex">
					<view class="e-radius-8 overflow-hidd">
						<e-skeleton-item variant="block">
							<view style="height:40rpx;width: 600rpx;"></view>
						</e-skeleton-item>
					</view>
				</view>
			</view>
			<view class="e-p-l-20 e-p-r-20 ">
				<view class="e-radius-8 overflow-hidd e-m-b-20">
					<e-skeleton-item variant="block">
						<view style="height:100rpx;"></view>
					</e-skeleton-item>
				</view>
				<view class="e-radius-8 overflow-hidd e-m-b-20">
					<e-skeleton-item variant="block">
						<view style="height:160rpx;"></view>
					</e-skeleton-item>
				</view>
				<view class="e-radius-8 overflow-hidd e-m-b-20">
					<e-skeleton-item variant="block">
						<view style="height:400px;"></view>
					</e-skeleton-item>
				</view>
			</view>
			<view class="fixed-bottom bg-white" style="z-index: 10101;">
				<view class="e-p-20 e-flex">
					<view class="e-flex-1 e-flex e-flex-between e-p-r-30">
						<view class="e-flex ">
							<e-skeleton-item variant="block">
								<view class="img-60"></view>
							</e-skeleton-item>
						</view>
						<view class="e-flex ">
							<e-skeleton-item variant="block">
								<view class="img-60"></view>
							</e-skeleton-item>
						</view>
						<view class="e-flex ">
							<e-skeleton-item variant="block">
								<view class="img-60"></view>
							</e-skeleton-item>
						</view>
					</view>
					<view>
						<view class="e-flex overflow-hidd" style="border-radius: 200rpx">
							<e-skeleton-item variant="block">
								<view style="height:88rpx;width: 360rpx;"></view>
							</e-skeleton-item>
						</view>
					</view>
				</view>
			</view>
		</e-skeleton>
	</view>
	<view class="page" :style="[pageStyle,AppSkinVar]" :class="{popupShow:showCouponPop}" v-show="!loading">

		<view v-if="isEmpty">
			<empty :icon="$staticPath('default_img.png')" :show="true" height="280rpx">
				<view class="text-center e-font-26 c-regular e-m-t-8">{{ $t('classify.该商品已下架') }}~</view>
			</empty>
		</view>
		<view v-else>


			<view v-for="(item, index) in componentsList" :key="item.key">
				<!-- 基础组件-->
				<!-- 商品信息 -->
				<i-goods-info v-if="item.components === 'goodsInfo'" :option="item.option" :info="goodsInfo"
					:activityGoodsSkuId="activityGoodsSkuId" :videoStop="videoStop" @setVideoStop="videoStop = false">
					<!-- 拼团 -->
					<template #spellGroup>
						<spellGroupSlot :groupListTotal="groupListTotal" :speList="speList"
							@handleShowAllGroup="handleShowAllGroup" @joinGroup="joinGroup"
							v-if="activityData.type === 2"></spellGroupSlot>
					</template>

					<!-- 秒杀 -->
					<template #seckill>
						<seckillSlot :seckillTime="seckillTime" :flashSaleStock="activityData.flashSaleStock"
							v-if="activityData.type === 1">
						</seckillSlot>
					</template>


					<template #sold>
						<view class="" v-if="activityData.type === 1"></view>
					</template>



					<template #price v-if="activityData.type === 1 || hasWholesalePricing">
						<priceSlot :skuId="activityGoodsSkuId" :flashSalePrice="activityData.flashSalePrice"
							:flashSaleOldPrice="activityData.flashSaleOldPrice" :priceMinimum="goodsInfo.priceMinimum"
							:priceMaximum="goodsInfo.priceMaximum"></priceSlot>
					</template>

					<!-- 优惠信息 -->
					<template #coupon>
						<couponSlot :info="goodsInfo" @click="showCouponPop = true" :couponList="couponList">
						</couponSlot>
					</template>




				</i-goods-info>
				<ServiceSpec v-if="item.components === 'serviceSpec'" :option="item.option" :info="goodsInfo"
					:checkInfo="checkInfo" @selectSku="openPopup(2)"></ServiceSpec>
				<ShopSign v-if="item.components === 'shopSign'" :option="item.option" :info="goodsInfo"></ShopSign>
				<Evaluation v-if="item.components === 'evaluation'" :option="item.option" :goodsId="goodsId">
				</Evaluation>
				<!-- <buyer v-if="item.components === 'buyer'" :option="item.option" :info="goodsInfo"></buyer> -->
				<bottom-button v-if="item.components === 'purchase'" :option="item.option" :info="goodsInfo"
					:isTrace="isTrace" @collect="handleCollect" @addCart="openPopup(2)" @buy="openPopup(1)"
					@setBottomHeight="setBottomHeight">
					<template #rightBtn v-if="activityData.type === 2">
						<spellGroupButtonSlot :activityData="activityData" @addCart="openPopup(2)" @buy="openPopup(1)">
						</spellGroupButtonSlot>
					</template>
				</bottom-button>

				<!-- 商品类组件 -->
				<i-goods-group v-if="item.components === 'goodsGroup'" :option="item.option" />
				<i-whole-goods v-if="item.components === 'wholeGoods'" :option="item.option" />
				<i-goods-tab v-if="item.components === 'goodsTab'" :option="item.option" />
				<i-goods-recommend v-if="item.components === 'goodsRecommend'" :option="item.option" />
				<i-goods-like v-if="item.components === 'goodsLike'" :option="item.option" />
				<i-boutique-recommend v-if="item.components === 'boutiqueRecommend'" :option="item.option" />
				<i-goods-banner v-if="item.components === 'goodsBanner'" :option="item.option" />
				<!-- 图文类组件 -->
				<i-magic-cube v-if="item.components === 'magicCube'" :option="item.option"></i-magic-cube>
				<i-list-nav v-if="item.components === 'listNav'" :option="item.option"></i-list-nav>
				<i-blank v-if="item.components === 'blank'" :option="item.option"></i-blank>
				<i-button-group v-if="item.components === 'buttonGroup'" :option="item.option"></i-button-group>
				<i-video v-if="item.components === 'video'" :option="item.option"></i-video>
				<i-my-rich-text v-if="item.components === 'richText'" :option="item.option" />
				<i-img-advert v-if="item.components === 'imgAdvert'" :option="item.option"></i-img-advert>
				<!-- 其他组件 -->
				<i-order-reminder v-if="item.components === 'orderReminder'" :option="item.option" />
			</view>
			<!-- 商品介绍 -->
			<introduction :info="goodsInfo"></introduction>
			
			<!-- 加个说明 -->
			<view>
				<view class="e-font-30 e-p-20 c-regular e-flex-xy-center">价格说明</view>
				<view class="e-p-l-20 e-p-r-20 c-regular e-p-b-30">
					1、平台价:平台价为商品的销售价，是您最终决定是否购买商品的依据。<br>
					2、划线价:商品展示的划横线价格为参考价，并非原价，该价格可能是品牌专柜标价、商品吊牌价、线下门店零售价或由品牌供应商提供的正品零售价(如厂商指导价、建议零售价等)或其他真实有依据的价格:由于地区、时间的差异性和市场行情波动，品牌专柜标价、商品吊牌价、线下门店零售价等可能会与您购物时展示的不一致，该价格仅供您参考。<br>
					3、折扣:如无特殊说明，1)折扣指销售商在原价或划线价(如品牌专柜标价、商品吊牌价、厂商指导价、厂商建议零售价、线下门店零售价)等某一价格基础上计算出的优惠比例、优惠金额或可使用的平台积分比例:2)商品页面展示折扣比例及划线价时，折扣数字为未划线价/划线价，可能因页面显示范围有限而无法展示折扣的完整数列，具体展示的折扣数字将会为您保留小数点后一到两位，优惠金额会因小数点后尾数取舍原因而与实际略有差异。如有疑问，您可在购买前联系销售商进行咨询。<br>
					4、预估到手价/到手价:是在商品标价基础上减去各种折扣、可用优惠政策叠加金额之后的一种预估的价格，计算公式示例:预估到手价=商品标价-优惠券-满减(或折扣)-新客优惠(如有)商家会员优惠(如有)，用户在进入结算页面之后，根据满足条件可享的活动(如所购商品超出商品促销价限购数量)、优惠券组合，可能导致最终到手价与显示预估到手价有差异和变化，并且不同用户可能因为可以享受的优惠不同(造成这种不同的原因包括是否属于新客或商家会员、可用优惠券差异、购买多件商品而满减活动仅支持享受1次等)而导致最终到手价不同。<br>
					5、配送费说明:配送费受配送距离、难度、时段、天气、运力:商品(数量、价格)等因素影响，商户首页及商品浏览页展示的配送费仅为预估配送费金额，最终以订单结算页显示的配送费会额为准。<br>
					6、其他问题:商品促销折扣兑换积分信息以商品详情页栏中的信息为准;商品的具体售价以订单结算页价格为准:如您发现活动商品售价或促销折扣兑换积分信息有异常，建议购买前先联系销售商咨询。
				</view>
			</view>

			<!-- 规格弹窗 -->
			<wholesale-popup v-if="wholesaleShow" v-model="popupShow" :popupType="popupType" :primary="AppSkin.primary"
				:info="skuInfo" @addCart="addCart" @buy="buy"></wholesale-popup>
			<sku-popup v-else v-model:info="skuInfo" v-model:goodsNum="goodsNum" v-model:checkInfo="checkInfo"
				v-model:skuId="activityGoodsSkuId" :goodsForm="goodsForm?.data" :goodsInfo="goodsInfo"
				:primary="AppSkin.primary" :show="popupShow" :popupType="popupType" :defaultSkuId="defaultSkuId"
				@updateActivityData="handleGetActivityData" @close="() => (popupShow = false)" @addCart="addCart"
				@buy="buy"></sku-popup>

			<!-- 拼团弹窗 -->
			<e-popup :show="showSpellPop" round="20rpx">
				<view class="sepll-group-pop">
					<view class="sgp-header e-flex e-flex-between e-p-l-20 e-p-r-20">
						<text class="e-font-28 fw-500">{{groupListTotal}}{{$t('spellgroup.ctrs')}}</text>
						<image class="img-36" :src="$staticPath('classify/close.png')" @tap="showSpellPop = false">
						</image>
					</view>
					<view class="spell-line"></view>
					<scroll-view scroll-y @scrolltolower="getAllGroupList" class="bg-white" lower-threshold="60">
						<view class="">
							<spell-item :key="index" :item="item" @join="joinGroup"
								v-for="(item, index) in allSpecList"></spell-item>
						</view>
					</scroll-view>
				</view>
			</e-popup>

			<!-- 优惠详情弹窗 -->
			<couponPop v-model="showCouponPop" :primary="AppSkin.primary" :couponList="couponList"
				:goodsInfo="goodsInfo"></couponPop>

			<view :style="[{height: bottomButtonHeight+'px'}]"></view>
			<view class="ios-btm"></view>
		</view>
	</view>
</template>

<script lang="ts" setup>
	import {
		ref,
		computed,
		onBeforeUnmount
	} from 'vue'
	import {
		useLayoutMainPage
	} from '@/pages/tabbar/utils/hooks'
	import {
		useCurrentInstance,
		usePromise
	} from '@/common/hooks'
	import {
		useUser,
		useShoppingCart
	} from '@/common/stores'
	import { storeToRefs } from 'pinia'
	import {
		onShow,
		onHide,
		onPageScroll
	} from '@dcloudio/uni-app'
	import ServiceSpec from './child/serviceSpec.vue'
	import Evaluation from './child/evaluation.vue'
	// import buyer from './child/buyer.vue'
	import ShopSign from './child/shopSign.vue'
	import introduction from './child/introduction.vue'
	import bottomButton from './child/bottomButton.vue'
	import skuPopup from './child/skuPopup.vue'
	import priceSlot from "./child/priceSlot.vue"
	import seckillSlot from "./child/seckillSlot.vue"
	import wholesalePopup from './child/wholesalePopup.vue'
	import spellItem from './child/spellitem.vue'
	import spellGroupButtonSlot from './child/spellGroupButtonSlot.vue'
	import spellGroupSlot from './child/spellGroupSlot.vue'
	import couponSlot from './child/couponSlot.vue'
	import couponPop from './child/couponPop.vue'


	import { getGoodsDetail, getGoodsSkuDetail, postAddCart, getCouponQueryProduct, getGoodsForm } from '@/common/request/api'
	import type { GoodsDetail, GoodsSkuSpecificationItem, GoodsSkuDetail, CartParams, CouponsItem } from '@/common/request/api'
	import { useActivity } from './hooks/useActivity'


	// import { getSeckillSkuInfo } from '@/common/request/api/seckill.js'
	// #ifdef MP-WEIXIN
	import { sceneParamsToObj } from '@/common/utils'
	// #endif
	// #ifdef PRIVATE || SUBSCRIPTION
	import { mpShareInit } from '@/common/utils'
	import type { MpShare } from '@/common/utils'
	import { getShareLink } from '@/common/wxInit'
	// #endif




	const props = defineProps<{
		scene ?: string
		id ?: string
		traceId ?: string
		skuId ?: string
	}>()

	const ctx = useCurrentInstance()
	const { isLogin } = storeToRefs(useUser())

	let menuButtonInfo = {
		width: 0,
		height: 0,
		top: 0,
		right: 0,
		bottom: 0,
		left: 0
	};
	// #ifdef MP
	menuButtonInfo = uni.getMenuButtonBoundingClientRect();
	// #endif

	const navbarHeight = 44 + menuButtonInfo.top;

	const navbarBgColor = ref('transparent');
	onPageScroll((e) => {
		// 小程序头部高度固定为24
		if (e.scrollTop <= navbarHeight) {
			navbarBgColor.value = 'transparent';
		} else if (e.scrollTop <= navbarHeight + 100) {
			navbarBgColor.value = `rgba(255, 255, 255,${((e.scrollTop - navbarHeight) / 100).toFixed(2)})`;
		} else {
			navbarBgColor.value = '#fff';
		}
	});

	let {
		pageStyle,
		componentsList,
		getPageInfo,
		mpShare,
		isDefaultShare
	} = useLayoutMainPage(ctx)

	const ShoppingCartStore = useShoppingCart()

	const goodsId = ref('')
	let pageParams : Record<string, any> = {}
	const isTrace = ref(false) // 是否来自视频带货
	const defaultSkuId = ref('') // 活动商品跳转进来时，默认选中的skuid
	const [refreshGoodsForm, goodsForm] = usePromise(async () => {
		return await getGoodsForm({ proId: goodsId.value })
	})
	const init = () => {
		let query = { ...props }
		// #ifdef MP-WEIXIN
		if (props.scene) {
			query = sceneParamsToObj(props.scene)
		}
		// #endif
		pageParams = query
		getPageInfo(3)
		if (query.id) goodsId.value = query.id
		if (query.traceId) {
			isTrace.value = true
		}
		if (query.skuId) {
			defaultSkuId.value = query.skuId
			// handleGetActivityData()
		}
		refreshGoodsForm()
	}
	init()


	const goodsInfo = ref<GoodsDetail>({
		deliveryBillingMode: 1,
		deliveryFeeUnified: 0,//统一配送费(0则是包邮)
		deliveryMode: '', //支持的发货方式，包含哪个就支持哪个 1快递 2自提 3-闪送 4-核销 5-配送 
		distributionType: 0,
		evaluateCount: 0,
		hasCollected: 0,
		hasOwn: 0,
		hasWholesalePricing: 0,
		id: '',
		minimumPurchaseQty: 0,
		maxNumber: 0,
		describes: '',
		name: '',
		price: 0,
		productCode: '',
		shareMsg: '',
		state: 4,
		stockSold: 0,
		storeDeliveryScore: 5,
		storeDescScore: 5,
		storeHasOwn: 0,
		storeId: '',
		storeLogo: '',
		storeName: '',
		storeProductCount: 5,
		storeServiceScore: 5,
		subareaId: '',
		type: 1,
		description: {
			detailRichTextMobile: '',
			detailRichTextPc: '',
			imgUrls: '',
			videoUrl: ''
		},
		activity: {}
	})
	const checkInfo = ref<GoodsSkuSpecificationItem | {}>({})//商品选中的sku
	const skuInfo = ref<GoodsSkuDetail>({
		id: -1,
		productSkuSpecifications: [],
		productSkus: []
	})
	const loading = ref(true)


	const updateGoodsPrice = (price : number) => {
		goodsInfo.value.price = price
	}

	const videoStop = ref(false)//是否暂停商品详情组件的视频播放
	const popupShow = ref(false)
	const popupType = ref<1 | 2>(1);
	const openPopup = (type : 1 | 2) => {
		if (goodsForm.value?.data && !isLogin.value) {
			ctx.$goLogin()
			return
		}
		videoStop.value = true
		popupType.value = type
		popupShow.value = true
		handleGetActivityData()
	}


	const handleCollect = (hasCollected : 0 | 1) => {
		goodsInfo.value.hasCollected = hasCollected
	}



	const {
		activityGoodsSkuId,
		activityData,
		allSpecList,
		groupListTotal,
		speList,
		showSpellPop,
		hasWholesalePricing,
		clearActivityTimeout,
		handleShowAllGroup,
		getAllGroupList,
		handleGetActivityData,
		handleReplaceOriginalToActivityData,
		seckillTime
	} = useActivity({
		goodsId,
		skuInfo,
		checkInfo,
		popupType,
		updateGoodsPrice
	})
	const wholesaleShow = computed(() => hasWholesalePricing.value && !goodsForm.value?.data)
	const groupCode = ref('')
	// 参与拼团
	const joinGroup = (_groupCode : string) => {
		showSpellPop.value = false
		openPopup(1)
		groupCode.value = _groupCode
	}

	const goodsNum = ref(1)

	// 跳预览页面
	const navigationToNormalPre = (url = '/pages/systemPay/goods/previewOrder') => {
		if (Object.keys((checkInfo.value as GoodsSkuSpecificationItem)).length) {
			if ((checkInfo.value as GoodsSkuSpecificationItem).stock == 0) {
				ctx.$toastApp(ctx.$t('classify.商品库存不足'))
				return
			}
			popupShow.value = false

			const deliveryMode = goodsInfo.value.deliveryMode?.split(',')
			let _receivingType = '2'
			if (deliveryMode) {
				if (deliveryMode.includes('3')) {
					_receivingType = '3'
				} else if (deliveryMode.includes('6')) {
					_receivingType = '6'
				} else {
					_receivingType = deliveryMode[0]
				}
			}
			let data : Record<string, any> = {
				skuId: (checkInfo.value as GoodsSkuSpecificationItem).id,
				qty: goodsNum.value,
				type: 1,
				receivingType: _receivingType
			}
			if (groupCode.value) data.groupCode = groupCode.value
			if (isTrace.value) {
				data['isTrace'] = '1'
			}
			ctx.$goTo(url, data)
			groupCode.value = ''


		} else {
			ctx.$toastApp(ctx.$t('classify.请选择商品规格'))
		}
	}

	type SkuList = { id : number, number ?: number }[]
	const addCart = (type ?: 1, skuList ?: SkuList) => {
		// 如果是拼团的，则是直接购买，即直接跳预览页面
		if (activityData.value && activityData.value.type === 2) {
			navigationToNormalPre()
			return
		}
		const data : CartParams[] = []
		if (type === 1) {
			// 批发

			skuList?.forEach(item => {
				if (item.number) {
					const param = {
						skuId: item.id,
						basketCount: item.number
					}
					data.push(param)
				}
			})
		} else {
			if (Object.keys((checkInfo.value as GoodsSkuSpecificationItem)).length) {
				if ((checkInfo.value as GoodsSkuSpecificationItem).stock == 0) {
					ctx.$toastApp('classify.商品库存不足')
					return
				}
				data.push({
					skuId: (checkInfo.value as GoodsSkuSpecificationItem).id,
					basketCount: goodsNum.value
				})

			} else {
				ctx.$toastApp(ctx.$t('classify.请选择商品规格'))
				return
			}
		}
		postAddCart(data).then(() => {
			popupShow.value = false
			ctx.$toastApp(ctx.$t('classify.已添加到购物车'))
			ShoppingCartStore.getCart()
		}).catch(res => {
			if (res.code === 401) {
				ctx.$goLogin()
			} else {
				ctx.$toastApp(res.msg)
			}
		})

	}

	const buy = (type ?: 1, skuList ?: SkuList) => {
		// 批发
		if (type === 1) {
			type Parmas = {
				buys : { qty : number, sku : string | number }[]
			}
			let params : Parmas = {
				buys: []
			}
			skuList?.forEach(item => {
				if (item.number) {
					params.buys.push({
						qty: item.number,
						sku: item.id
					})
				}
			})
			const deliveryMode = goodsInfo.value.deliveryMode?.split(',')
			let _receivingType = '2'
			if (deliveryMode) {
				if (deliveryMode.includes('3')) {
					_receivingType = '3'
				} else if (deliveryMode.includes('6')) {
					_receivingType = '6'
				} else {
					_receivingType = deliveryMode[0]
				}
			}
			ctx.$goTo('/pages/systemPay/goods/previewOrder', { type: 3, receivingType: _receivingType, buys: JSON.stringify(params) })
			return
		}
		const url = activityData.value && activityData.value.type === 2 ? '/pages/systemPay/goods/previewGroupOrder' : '/pages/systemPay/goods/previewOrder'
		navigationToNormalPre(url)
	}


	const bottomButtonHeight = ref(62)
	const setBottomHeight = (height : number) => {
		bottomButtonHeight.value = height
	}



	// 商品是否已下架
	const isEmpty = ref(false)
	const couponList = ref<CouponsItem[]>([])
	const showCouponPop = ref(false)
	const handleGetCoupon = () => {
		if (!goodsInfo.value.id) return
		getCouponQueryProduct(goodsInfo.value.id).then(res => {
			couponList.value = res.data || []
		})
	}
	const shareInit = () => {
		let imgUrls = goodsInfo.value?.description?.imgUrls ? goodsInfo.value?.description?.imgUrls.split(',')[0] : ''
		// #ifdef APP-PLUS
		uni.$endless.mpShare = {
			title: goodsInfo.value.name,
			path: '',
			appDesc: goodsInfo.value.shareMsg || '',
			imageUrl: ctx.$fullLink(imgUrls),
			appParams: pageParams
		}
		// #endif

		// #ifdef MP-WEIXIN||MP-ALIPAY
		if (isDefaultShare.value) {
			mpShare = {
				title: goodsInfo.value.name,
				path: '', // 默认为当前页面路径
				imageUrl: ctx.$fullLink(imgUrls)
			}
			uni.$endless.mpShare = mpShare
		}
		// #endif
		// #ifdef PRIVATE || SUBSCRIPTION
		uni.$endless.mpShare = {
			title: goodsInfo.value.name,
			link: getShareLink(),
			desc: goodsInfo.value.shareMsg || '',
			imgUrl: ctx.$fullLink(imgUrls)
		}
		mpShareInit(mpShare as MpShare)
		// #endif
	}
	onShow(async () => {

		checkInfo.value = {}
		if (goodsId.value) {
			getGoodsSkuDetail({ productId: goodsId.value }).then(res => {

				skuInfo.value = res.data
				if (activityGoodsSkuId.value) {
					handleReplaceOriginalToActivityData()
				}

			})

			try {

				let detail = await getGoodsDetail({ id: goodsId.value })
				loading.value = false
				if (detail?.data?.state !== 3) {
					isEmpty.value = true
					return
				}
				

				goodsInfo.value = detail.data
				// 活动优先级高于批发，如果存在活动价则不显示批发价
				if (activityData.value.type) {
					hasWholesalePricing.value = 0
				} else {
					hasWholesalePricing.value = goodsInfo.value.hasWholesalePricing
				}
				// 页面分享的初始化
				shareInit()
				goodsNum.value = goodsInfo.value.minimumPurchaseQty


			} catch (e) {
				isEmpty.value = true
				loading.value = false
				console.log(e)
			}
		}
		if (activityGoodsSkuId.value || checkInfo.value && Object.keys(checkInfo.value).length) {
			// 查看活动信息
			if (activityGoodsSkuId.value) {
				handleGetActivityData()
			} else {
				activityGoodsSkuId.value = (checkInfo.value as GoodsSkuSpecificationItem).id
				handleGetActivityData()
			}
		} else {
			// 查询拼团信息
			const pages = getCurrentPages()
			if (pages[pages.length - 1].$page?.options?.skuId) {
				activityGoodsSkuId.value = pages[pages.length - 1].$page.options.skuId
				handleGetActivityData()
			}
		}
		// 查询一个商品可领取的优惠券
		handleGetCoupon()

	})
	onHide(() => {
		videoStop.value = true
	})

	onBeforeUnmount(() => {
		clearActivityTimeout()
	})
</script>

<style lang="scss" scoped>
	.page {
		min-height: 100vh;
	}

	.sepll-group-pop {
		border-radius: 20rpx 20rpx 0rpx 0rpx;

		.sgp-header {
			height: 100rpx;
			color: #343434;
		}
	}

	.popupShow {
		overflow: hidden;
		position: fixed;
		width: 100vw;
		height: 100vh;
	}
</style>